package study.thread.atomic;

public class AtomicAccountThread extends Thread {
	private AtomicAccount atomicAccount;
	int delay;

	public AtomicAccountThread(AtomicAccount atomicAccount, int delay) {
		this.atomicAccount = atomicAccount;
		this.delay = delay;
	}

	public void run() {
		atomicAccount.withdraw(100, delay);
	}

	public static void main(String[] args) {

		AtomicAccount account = new AtomicAccount(880);

		AtomicAccountThread t1 = new AtomicAccountThread(account, 1000);
		AtomicAccountThread t2 = new AtomicAccountThread(account, 0);

		t1.start();
		t2.start();
	}
}
